﻿//using System;
//using System.Collections.Generic;
//using System.Linq;
//using System.Text;
//using Hotel.UI.Common.Services;
//using Hotel.UI.Views;
//using Unity;
//using Unity.Lifetime;
//using Unity.Resolution;

//namespace Hotel.UI.Common
//{
//    public class UnityContainerManager
//    {

//        private static UnityContainer _Instance;

//        public static UnityContainer Instance
//        {
//            get { return _Instance; }
//        }

//        static UnityContainerManager()
//        {
//            _Instance = new UnityContainer();
//            //_Instance.RegisterInstance(new ChangeHeaderIcon(), new ExternallyControlledLifetimeManager());
//        }

//        public static T RegisterInstance<T>() where T : class, new()
//        {

//            return _Instance.Resolve<T>();
//        }
//        public static T Resolve<T>() where T : class, new()
//        {
//            if (_Instance.Resolve<T>() == null)
//            {
//                _Instance.RegisterType<T>();
//            }

//            return _Instance.Resolve<T>();
//        }
//        public static T Resolve<T>(params Unity.Resolution.ResolverOverride[] overrides)
//        {
//            if (_Instance.Resolve<T>(overrides) == null)
//            {
//                _Instance.RegisterType<T>();

//            }

//            return _Instance.Resolve<T>(overrides);
//        }

//        public static T ResolveSingleInstance<T>() where T : class, new()
//        {
//            T t = _Instance.Resolve<T>(typeof(T).Name);
//            if (t == null)
//            {
//                _Instance.RegisterInstance<T>(typeof(T).Name, new T(), new ExternallyControlledLifetimeManager());
//            }

//            return _Instance.Resolve<T>(typeof(T).Name);
//        }
//    }
//}
